import 'package:flutter/material.dart';
import 'package:rainflutter/extends/btn_test.dart';

class NewButton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('新按钮'),
        ),
        body: Column(
          children: [
            newButtonnUse(),
            const SizedBox(height: 40),
            compareWidget()
          ],
        ));
  }

  Widget newButtonnUse() {
    return Column(
      children: [
        OutlinedButton(
          // style: ButtonStyle(
          //     textStyle: MaterialStateProperty.all(TextStyle(
          //         fontSize: EsSizes.LG,
          //         fontWeight: EsFontWeights.Normal)),
          //     foregroundColor: MaterialStateProperty.all(
          //       EsColors.Primary,
          //     ),
          //     shape: MaterialStateProperty.all(
          //         RoundedRectangleBorder(
          //             borderRadius:
          //                 BorderRadius.circular(20.0))),
          //     overlayColor:
          //         MaterialStateProperty.all(EsColors.White),
          //     side: MaterialStateProperty.all(BorderSide(
          //         color: EsColors.Primary, width: 1))),
          style: OutlinedButton.styleFrom(
            // onSurface: EsColors.White,
            backgroundColor: Colors.pink,
            // shadowColor: EsColors.White,
            // primary: Colors.white,
            shape:
                RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
            side: BorderSide(color: Colors.yellow, width: 1),
            // textStyle: TextStyle(
            //     fontSize: EsSizes.LG,
            //     color: EsColors.Primary,
            //     fontWeight: EsFontWeights.Normal),
          ),
          child: Padding(
            padding: const EdgeInsets.only(top: 10.0, bottom: 10),
            child: Text(
              'OutlinedButton',
              style: TextStyle(
                  fontSize: 16,
                  color: Colors.yellow,
                  fontWeight: FontWeight.normal),
            ),
          ),
          onPressed: () {
            List aaa = [1, 2, 3, 4, 5, 6];
            print('aaa$aaa');
            print(aaa.toString());
            print('aaa' + aaa.toString());
          },
        ),
        ElevatedButton(
          style: ElevatedButton.styleFrom(
            primary: Colors.yellow,
            onPrimary: Colors.yellow,
            shadowColor: Colors.white,
            onSurface: Colors.white,
            elevation: 0,
            shape:
                RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
          ),
          child: Padding(
            padding: const EdgeInsets.only(top: 10.0, bottom: 10.0),
            child: Text(
              'ElevatedButton',
              style: TextStyle(
                  color: Colors.white,
                  fontSize: 16,
                  fontWeight: FontWeight.normal),
            ),
          ),
          onPressed: () {},
        ),FstButton(),
        TextButton(
          onPressed: () {
            print('object');
          },
          child: Text('TextButton'),
          style: ButtonStyle(
            minimumSize: MaterialStateProperty.all(Size(50, 20)),
            // 按钮文字颜色
            foregroundColor: MaterialStateProperty.resolveWith((states) {
              if (states.contains(MaterialState.disabled)) {
                return Colors.grey[500];
              }
              if (states.contains(MaterialState.pressed)) {
                return Colors.orange[500];
              }
              return Colors.white;
            }),
            textStyle: // 不设置按钮文字的颜色
                MaterialStateProperty.resolveWith((Set<MaterialState> states) {
              if (states.contains(MaterialState.disabled)) {
                return TextStyle(fontSize: 15);
              }
              if (states.contains(MaterialState.pressed)) {
                return TextStyle(fontSize: 10);
              }
              return TextStyle(fontSize: 20);
            }),
            backgroundColor: // 按钮整体颜色
                MaterialStateProperty.resolveWith((Set<MaterialState> states) {
              if (states.contains(MaterialState.disabled)) {
                return Colors.grey[400];
              }
              return Colors.black;
            }),
          ),
        )
      ],
    );
  }

  Widget compareWidget() {
    return Column(
      children: [
        Row(
          children: <Widget>[
            OutlineButton(
              onPressed: () {},
              child: Text('OutlineButton',
                  style: TextStyle(
                    //中间删除线 TextDecoration.lineThrough
                    //底部下划线TextDecoration.underline
                    //顶部上划线 TextDecoration.overline
                    decoration: TextDecoration.lineThrough,
                    // fontSize: 14,
                    // color: Colors.grey,
                  )),
            ),
            const SizedBox(
              width: 16,
            ),
            OutlinedButton(
              child: Text('OutlinedButton'),
              onPressed: () {},
            ),
          ],
        ),
        Row(
          children: [
            RaisedButton(
              onPressed: () {},
              child: Text('RaisedButton',
                  style: TextStyle(
                    //中间删除线 TextDecoration.lineThrough
                    //底部下划线TextDecoration.underline
                    //顶部上划线 TextDecoration.overline
                    decoration: TextDecoration.lineThrough,
                    // fontSize: 14,
                    // color: Colors.grey,
                  )),
            ),
            const SizedBox(width: 40),
            ElevatedButton(
              child: Text('ElevatedButton'),
              onPressed: () {},
            ),
          ],
        ),
        Row(
          children: [
            FlatButton(
                onPressed: () {},
                child: Text('floatbutton',
                    style: TextStyle(
                      //中间删除线 TextDecoration.lineThrough
                      //底部下划线TextDecoration.underline
                      //顶部上划线 TextDecoration.overline
                      decoration: TextDecoration.lineThrough,
                      // fontSize: 14,
                      // color: Colors.grey,
                    ))),
            const SizedBox(width: 40),
            TextButton(onPressed: () {}, child: Text('TextButton'))
          ],
        )
      ],
    );
  }
}
